-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: correct unsafe URL example in http docs #52555
doc: correct unsafe URL example in http docs #52555
Conversation
Review requested:
|
LGTM |
I kinda like it. |
430c3dd
to
4d39eb2
Compare
I will try to formulate something that doesn't get to complicated. For the classic copy/paste developer this at least contains no surprises. Everyone else beyond that will understand how to adapt this. Should I document something about the dangers of the |
I would say keep it. When it's about security we are never verbose enough ;) |
4d39eb2
to
2e593a6
Compare
The previous documentation example for converting `request.url` to an `URL` object was unsafe, as it could allow a server crash through malformed URL inputs and potentially enable host header attacks. This commit revises the example to use string concatenation over the usage of the `baseUrl` and removes the usage of the `req.headers.host` as the authority part of the url, mitigating both the crash and security risks by ensuring the host part of the URL remains controlled and predictable. Fixes nodejs#52494 Co-authored-by: @astlouisf Co-authored-by: @samhh
2e593a6
to
e1f6dc7
Compare
Everything seems good to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice job!
@mlegenhausen can you please fix the lint issue? |
@lpinca fixed |
Landed in 461722d |
The previous documentation example for converting `request.url` to an `URL` object was unsafe, as it could allow a server crash through malformed URL inputs and potentially enable host header attacks. This commit revises the example to use string concatenation over the usage of the `baseUrl` and removes the usage of the `req.headers.host` as the authority part of the url, mitigating both the crash and security risks by ensuring the host part of the URL remains controlled and predictable. Fixes #52494 Co-authored-by: @astlouisf Co-authored-by: @samhh PR-URL: #52555 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
The previous documentation example for converting `request.url` to an `URL` object was unsafe, as it could allow a server crash through malformed URL inputs and potentially enable host header attacks. This commit revises the example to use string concatenation over the usage of the `baseUrl` and removes the usage of the `req.headers.host` as the authority part of the url, mitigating both the crash and security risks by ensuring the host part of the URL remains controlled and predictable. Fixes #52494 Co-authored-by: @astlouisf Co-authored-by: @samhh PR-URL: #52555 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
The previous documentation example for converting `request.url` to an `URL` object was unsafe, as it could allow a server crash through malformed URL inputs and potentially enable host header attacks. This commit revises the example to use string concatenation over the usage of the `baseUrl` and removes the usage of the `req.headers.host` as the authority part of the url, mitigating both the crash and security risks by ensuring the host part of the URL remains controlled and predictable. Fixes #52494 Co-authored-by: @astlouisf Co-authored-by: @samhh PR-URL: #52555 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Co-authored-by: @astlouisf
Co-authored-by: @samhh
The previous documentation example for converting
request.url
to anURL
object was unsafe, as it could allow a server crash through malformed URL inputs and potentially enable host header attacks.This commit revises the example to use string concatenation over the usage of the
baseUrl
and removes the usage of thereq.headers.host
as the authority part of the url, mitigating both the crash and security risks by ensuring the host part of the URL remains controlled and predictable.Fixes #52494
Successor of #52536